package com.ahwei.util;

import java.math.BigInteger;
import java.security.MessageDigest;

/**
 * @author：ahwei163@qq.com
 * Email: @qq1632957243
 * @date: 202*-01-13 14:58
 * @description: MD加密工具类！
 */
public class MD5Util {
    /**
     * MD加密工具
     * @param content ·
     * @return ·
     */
    public static String encrypt(String content) {
        try {
            MessageDigest md = MessageDigest.getInstance("md5");
            byte[] arr = md.digest(content.getBytes());
            String encrypted = new BigInteger(1, arr).toString(16);
            for (int i = 0; i < 32 - encrypted.length(); i++) {
                encrypted = "0" + encrypted;
            }
            return encrypted;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return content;
    }
}
